var $ = function $(id){return document.getElementById(id);}
var clert_content = $('clert_content'),
    clear_outer = $('clear_outer'),
    clert = $('clert'),
    ent = $('ent');
function init(){
    for (var i = 0; i < 16; i++) {
        var ele = $(i);
        if(null == ele){
           continue;
        }else{
            eval("q_"+i+"(0);");        
        }
    };
};
function check()
{
    var error = 0;
    for (var i = 0; i < 16; i++) {
        var ele = $(i);
        if(null == ele){
           continue;
        }else{
            if(false == eval("q_"+i+"(1);"))
            {
                error = i;
                break;
            }       
        }
    };
    if(error){
        $('clert').style.display = "block";
        // alert("问题"+error+"必须回答");
    }else{
        $('ent').submit();
    }
    $('clert_content').onclick = function (){
         $('clert').style.display = "none";
    }
}
function q_1(ac)
{

}
function q_2(ac)
{
    if(ac == 1){
        var q = document.getElementById("2");
        var op = q.getElementsByTagName("input");
        if(op[1].value == false){
            return false;
        }      
    }
}

function q_3(ac)
{
    var q = document.getElementById("3");
    var qli = q.getElementsByTagName("li");
    var op = q.getElementsByTagName("input");
    var img1 = document.getElementById('radio_img1');
    var img2 = document.getElementById('radio_img2');
    var checkbox_img1 = document.getElementById("checkbox_img1");
    var checkbox_img2 = document.getElementById("checkbox_img2");
    var checkbox_img3 = document.getElementById("checkbox_img3");
    for (var i = 0; i < qli.length-2; i++) {
        qli[i].onclick = function (){
            if (op[1].checked == true) {
                checkbox_img1.style.backgroundImage = "url(images/duihao.jpg)";
            }else if(op[1].checked != true){
                checkbox_img1.style.backgroundImage = "";
            };
            if (op[2].checked == true) {
                checkbox_img2.style.backgroundImage = "url(images/duihao.jpg)";
            }else if(op[2].checked != true){
                checkbox_img2.style.backgroundImage = "";
            };
            if (op[3].checked == true) {
                checkbox_img3.style.backgroundImage = "url(images/duihao.jpg)";
            }else if(op[3].checked != true){
                checkbox_img3.style.backgroundImage = "";
            };
        }
    };
    qli[3].onclick = function (){
        if (op[4].checked == true) {
            img1.style.backgroundImage = "url(images/duihao.jpg)";
            if (op[5].checked == true) {
                op[5].checked = false;
                img2.style.backgroundImage = "";
            }else if (op[5].checked == false) {
                op[4].checked == false; 
                img1.style.backgroundImage = "url(images/duihao.jpg)";
            };
        }else{
            img1.style.backgroundImage = "";
        }
    }
    qli[4].onclick = function (){
        if (op[5].checked == true) {
            img2.style.backgroundImage = "url(images/duihao.jpg)";
            if (op[4].checked == true) {
                op[4].checked = false;
                img1.style.backgroundImage = "";
            }else if (op[4].checked == false) {
                op[5].checked == false;
                img2.style.backgroundImage = "url(images/duihao.jpg)";
            };
        }else{
            img2.style.backgroundImage = "";
        }
    };
}
function q_4(ac)
{
    var q = document.getElementById("4");
    var qli = q.getElementsByTagName("li");
    var op = q.getElementsByTagName("input");
    var checkbox_img4 = document.getElementById("checkbox_img4");
    var checkbox_img5 = document.getElementById("checkbox_img5");
    var checkbox_img6 = document.getElementById("checkbox_img6");
    // var checkbox_img7 = document.getElementById("checkbox_img7");
    // var checkbox_img8 = document.getElementById("checkbox_img8");
    for (var i = 0; i < qli.length; i++) {
        qli[i].onclick = function (){
            if (op[1].checked == true) {
                checkbox_img4.style.backgroundImage = "url(images/duihao.jpg)";
            }else if(op[1].checked != true){
                checkbox_img4.style.backgroundImage = "";
            };
            if (op[2].checked == true) {
                checkbox_img5.style.backgroundImage = "url(images/duihao.jpg)";
            }else if(op[2].checked != true){
                checkbox_img5.style.backgroundImage = "";
            };
            if (op[3].checked == true) {
                checkbox_img6.style.backgroundImage = "url(images/duihao.jpg)";
            }else if(op[3].checked != true){
                checkbox_img6.style.backgroundImage = "";
            };
            // if (op[4].checked == true) {
            //     checkbox_img7.style.backgroundImage = "url(images/duihao.jpg)";
            // }else if(op[4].checked != true){
            //     checkbox_img7.style.backgroundImage = "";
            // };
            // if (op[5].checked == true) {
            //     checkbox_img8.style.backgroundImage = "url(images/duihao.jpg)";
            // }else if(op[5].checked != true){
            //     checkbox_img8.style.backgroundImage = "";
            // };
        }
    };
}

function q_5(ac)
{
    var q = document.getElementById("5");
    // var op = q.getElementsByTagName("input");
    // op[1].value = op[2].value;
    // if(ac == 1){
    //     if(op[1].value.length == 0){
    //         return false;
    //     }      
    // }
    // var t;
    // op[2].onmouseover = function(){
    //     function carr(){
    //         op[1].value = op[2].value;
    //     }
    //     t = setInterval(carr,1);
    // }
    // op[2].onmouseout = function(){
    //     clearInterval(t);
    // }
}

function q_6(ac)
{
    var ifs16 = $('ifs16'),
            ifs26 = $('ifs26'),
            clear_yes = $('clear_yes'),
            clear_no = $('clear_no');
    var img3 = document.getElementById('radio_img3');
    var img4 = document.getElementById('radio_img4');
    var img5 = document.getElementById('radio_img5');
    var img6 = document.getElementById('radio_img6');
    var img7 = document.getElementById('radio_img7');
    var img8 = document.getElementById('radio_img8');
    var q = document.getElementById("6");
    var qli = q.getElementsByTagName("li");
    var op = q.getElementsByTagName("input");
    op[3].value = op[4].value;
    if(ac == 1){
        if(op[1].checked == false&&op[2].checked == false) {
            return false;
        }
        if(op[1].checked == true){
            if (op[3].value.length == 0) {
                return false;
            };
            if (op[4].checked == false&&op[5].checked == false) {
                return false;
            }
        }else if(op[2].checked == true){
            if (op[6].checked == false&&op[7].checked == false) { 
                return false;
            };
        }

    }
    if (ac == 0) {
        for (var i = 0; i < qli.length; i++) {
            qli[i].onclick = function(){
                if (op[1].checked == true) {
                    clear_yes.style.display = "block";
                    clear_no.style.display = "none";
                    img3.style.backgroundImage = "url(images/duihao.jpg)";
                    img4.style.backgroundImage = "";
                }else if (op[2].checked == true) {
                    clear_yes.style.display = "none";
                    clear_no.style.display = "block";
                    img4.style.backgroundImage = "url(images/duihao.jpg)";
                    img3.style.backgroundImage = "";
                }
                if (op[3].checked == true) {
                    img5.style.backgroundImage = "url(images/duihao.jpg)";
                    img6.style.backgroundImage = "";
                }else if (op[4].checked == true) {
                    img6.style.backgroundImage = "url(images/duihao.jpg)";
                    img5.style.backgroundImage = "";
                }
                if (op[5].checked == true) {
                    img7.style.backgroundImage = "url(images/duihao.jpg)";
                    img8.style.backgroundImage = "";
                }else if (op[6].checked == true) {
                    img8.style.backgroundImage = "url(images/duihao.jpg)";
                    img7.style.backgroundImage = "";
                } 
            }
        };
    };
}
function q_7(ac)
{
    var q = document.getElementById("7");
    var op = q.getElementsByTagName("input");
    var qli = q.getElementsByTagName("li");
    var img9 = document.getElementById('radio_img9');
    var img10 = document.getElementById('radio_img10');
    if(ac == 1){
        if(op[1].checked == false&&op[2].checked == false){
            return false;
        }    
    }
    qli[0].onclick = function(){
         if (op[1].checked == true) {
            img9.style.backgroundImage = "url(images/duihao.jpg)";
            img10.style.backgroundImage = "";
        }else if (op[2].checked == true) {
            img10.style.backgroundImage = "url(images/duihao.jpg)";
            img9.style.backgroundImage = "";
        } 
    }      
}

function q_8(ac)
{
    var q = document.getElementById("8");
    var op = q.getElementsByTagName("input");
    var qli = q.getElementsByTagName("li");
    var img11 = document.getElementById('radio_img11');
    var img12 = document.getElementById('radio_img12');
    if(ac == 1){
        if(op[1].checked == false&&op[2].checked == false){
            return false;
        }     
    }
    qli[0].onclick = function(){
         if (op[1].checked == true) {
            img11.style.backgroundImage = "url(images/duihao.jpg)";
            img12.style.backgroundImage = "";
        }else if (op[2].checked == true) {
            img12.style.backgroundImage = "url(images/duihao.jpg)";
            img11.style.backgroundImage = "";
        } 
    } 
}

function q_9(ac)
{
    var q = document.getElementById("9");
    var op = q.getElementsByTagName("input");
    var qli = q.getElementsByTagName("li");
    var img13 = document.getElementById('radio_img13');
    var img14 = document.getElementById('radio_img14');;
    if(ac == 1){
        if(op[1].checked == false&&op[2].checked == false){
            return false;
        }     
    }
    qli[0].onclick = function(){
         if (op[1].checked == true) {
            img13.style.backgroundImage = "url(images/duihao.jpg)";
            img14.style.backgroundImage = "";
        }else if (op[2].checked == true) {
            img14.style.backgroundImage = "url(images/duihao.jpg)";
            img13.style.backgroundImage = "";
        } 
    }  
}

function q_10(ac)
{
    var q = document.getElementById("10");
    var op = q.getElementsByTagName("input");
    var qli = q.getElementsByTagName("li");
    var img15 = document.getElementById('radio_img15');
    var img16 = document.getElementById('radio_img16');;
    if(ac == 1){
        if(op[1].checked == false&&op[2].checked == false){
            return false;
        }     
    }
    qli[0].onclick = function(){
         if (op[1].checked == true) {
            img15.style.backgroundImage = "url(images/duihao.jpg)";
            img16.style.backgroundImage = "";
        }else if (op[2].checked == true) {
            img16.style.backgroundImage = "url(images/duihao.jpg)";
            img15.style.backgroundImage = "";
        } 
    }  
}

function q_11(ac)
{
    var q = document.getElementById("11");
    var op = q.getElementsByTagName("input");
    var qli = q.getElementsByTagName("li");
    var img17 = document.getElementById('radio_img17');
    var img18 = document.getElementById('radio_img18');;
    if(ac == 1){
        if(op[1].checked == false&&op[2].checked == false){
            return false;
        }     
    }
    qli[0].onclick = function(){
         if (op[1].checked == true) {
            img17.style.backgroundImage = "url(images/duihao.jpg)";
            img18.style.backgroundImage = "";
        }else if (op[2].checked == true) {
            img18.style.backgroundImage = "url(images/duihao.jpg)";
            img17.style.backgroundImage = "";
        } 
    } 
}

function q_12(ac)
{
    var q = document.getElementById("12");
    var op = q.getElementsByTagName("input");
    var qli = q.getElementsByTagName("li");
    var img19 = document.getElementById('radio_img19');
    var img20 = document.getElementById('radio_img20');;
    if(ac == 1){
        if(op[1].checked == false&&op[2].checked == false){
            return false;
        }      
    }
    qli[0].onclick = function(){
         if (op[1].checked == true) {
            img19.style.backgroundImage = "url(images/duihao.jpg)";
            img20.style.backgroundImage = "";
        }else if (op[2].checked == true) {
            img20.style.backgroundImage = "url(images/duihao.jpg)";
            img19.style.backgroundImage = "";
        } 
    } 
}

function q_13(ac)
{
    var q = document.getElementById("13");
    var op = q.getElementsByTagName("input");
    var qli = q.getElementsByTagName("li");
    var img21 = document.getElementById('radio_img21');
    var img22 = document.getElementById('radio_img22');
    if(ac == 1){
        if(op[1].checked == false&&op[2].checked == false){
            return false;
        }     
    }
    qli[0].onclick = function(){
         if (op[1].checked == true) {
            img21.style.backgroundImage = "url(images/duihao.jpg)";
            img22.style.backgroundImage = "";
        }else if (op[2].checked == true) {
            img22.style.backgroundImage = "url(images/duihao.jpg)";
            img21.style.backgroundImage = "";
        } 
    }  
}

function q_14(ac)
{   
    var q = document.getElementById("14");
    var op = q.getElementsByTagName("input");
    var qli = q.getElementsByTagName("li");
    var img23 = document.getElementById('radio_img23');
    var img24 = document.getElementById('radio_img24');
    if(ac == 1){
        if(op[1].checked == false&&op[2].checked == false){
            return false;
        }      
    }
    qli[0].onclick = function(){
         if (op[1].checked == true) {
            img23.style.backgroundImage = "url(images/duihao.jpg)";
            img24.style.backgroundImage = "";
        }else if (op[2].checked == true) {
            img24.style.backgroundImage = "url(images/duihao.jpg)";
            img23.style.backgroundImage = "";
        } 
    } 
}
function q_15(ac)
{
    var q = document.getElementById("15");
    var op = q.getElementsByTagName("input");
    var qli = q.getElementsByTagName("li");
    var img25 = document.getElementById('radio_img25');
    var img26 = document.getElementById('radio_img26');
    if(ac == 1){
        if(op[1].checked == false&&op[2].checked == false){
            return false;
        }
             
    }
    qli[0].onclick = function(){
         if (op[1].checked == true) {
            img25.style.backgroundImage = "url(images/duihao.jpg)";
            img26.style.backgroundImage = "";
        }else if (op[2].checked == true) {
            img26.style.backgroundImage = "url(images/duihao.jpg)";
            img25.style.backgroundImage = "";
        } 
    }  
}

function q_16()
{
  
}
//*/